package Dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory;

import Data.Status;
import Data.UserFriend;
import Data.Users;

public class DaoTest {
    
    static final String USER_STRING = "root" ;
	
    static final String PASS_STRING = "123456" ;
	
    static final String DB_URL = "jdbc:mysql:///the_users" ;
    
    static final String DRIVER_STRING = "com.mysql.jdbc.Driver" ;
    
    public static void main(String[] args) {
	// TODO Auto-generated method stub
	
	//testWeiboToken() ;
	
	//testWeiboFriend();
	
	//testWeiboStatus();
	
    }
    
    private static void testWeiboToken(){
	
	Users users = new Users() ;
	
	users.setUserId("19940907");
	
	users.setUserName("LXLx");
	
	WeiboToken weiboToken = new WeiboToken() ;
	
	weiboToken.insertUser(users);
	
	users.setUserToken("lxlxlsb");
	
	weiboToken.updateUser(users);
	
	Users users2 = weiboToken.queryUser(users.getUserId()) ;
	
	weiboToken.deleteUser(users);
	
    }
    
    private static void  testWeiboFriend(){
	
	UserFriend userFriend1 = new UserFriend() ;

	userFriend1.setUserId("19950907");
	
	userFriend1.setFriendId("19940907");
	
	userFriend1.setFriendName("sblx");
	
	UserFriend userFriend2 = new UserFriend();
	
	userFriend2.setUserId("91105");
	
	userFriend2.setFriendId("91104");
	
	userFriend2.setFriendName("guoguoguochen");
	
	UserFriend userFriend3 = new UserFriend() ;
	
	userFriend3.setUserId("3111");
	
	userFriend3.setUserId("11113");
	
	userFriend3.setFriendName("shifangji");
	
	UserFriend userFriend4 = new UserFriend();
	
	userFriend4.setUserId("91105");
	
	userFriend4.setFriendId("131323");
	
	userFriend4.setFriendName("qinshishi");
	
	WeiboFriend weiboFriend = new WeiboFriend() ;
	
	weiboFriend.insetFriends(userFriend1);
	
	weiboFriend.insetFriends(userFriend2);
	
	weiboFriend.insetFriends(userFriend3);
	
	weiboFriend.insetFriends(userFriend4);
	
	weiboFriend.queryFriend("91105") ;
	
	weiboFriend.deleteFriend(userFriend1);
	
	weiboFriend.deleteFriend(userFriend3);
	
	weiboFriend.deleteFriends("91105");
		
    }
    
    private static void testWeiboStatus(){
	
	Status status1 = new Status() ;
	
	status1.setUserId("12313");
	
	status1.setSenderId("5555");
	
	status1.setSenderName("ddd");
	
	status1.setText("nicaiwo jintian ");
	
	Status status2 = new Status() ;
	
	status2.setUserId("11111");
	
	status2.setSenderId("3333");
	
	status2.setSenderName("df");
	
	status2.setText("henshangxin ");
	
	Status status3 = new Status() ;
	
	status3.setUserId("11111");
	
	status3.setSenderId("3333");
	
	status3.setSenderName("df");
	
	status3.setText("badbadbad");
	
	Status status4 = new Status() ;
	
	status4.setUserId("12313");
	
	status4.setSenderId("ddd");
	
	status4.setSenderName("fafe");
	
	status4.setText("dfaee");
	
	Status status5 = new Status() ;
	
	status5.setUserId("fadfaf");
	
	status5.setSenderId("222");
	
	status5.setSenderName("333");
	
	status5.setText("fadgaghao ba");
	
	WeiboStatus weiboStatus = new WeiboStatus() ;
	
	weiboStatus.insertStatus(status1);
	
	weiboStatus.insertStatus(status2);
	
	weiboStatus.insertStatus(status3);
	
	weiboStatus.insertStatus(status4);
	
	weiboStatus.insertStatus(status5);
	
	weiboStatus.queryStatus("11111") ;
	
	weiboStatus.deleteStatus(status5);
	
	weiboStatus.deleteStatus("12313");
	
	weiboStatus.deleteStatus("11111", "3333");
    }
    
}
